def partition_eq_set(nums):
    total = sum(nums)
    if total % 2: return False
    target = total // 2

    no = len(nums)
    # a row = an item (i->item)
    # a column = capacity
    dp = [[False] * (target + 1) for i in range(no)]

    # base, 0 capacity
    for i in range(no):
        dp[i][0] = True

    for i in range(no):
        for j in range(1, target + 1):
            if j - nums[i] >= 0:
                dp[i][j] = dp[i - 1][j] or dp[i - 1][j - nums[i]]
            else:
                dp[i][j] = dp[i - 1][j]

    return dp[no-1][target]

print(partition_eq_set([1, 5, 11, 5]))
print(partition_eq_set([1, 2, 3, 5]))